package top.zuli.package01.class13;

public class ThreadDemo33 extends Thread {
    public static void main(String[] args) {
        Thread thread = new Thread5();
        Thread thread1 = new Thread6();
        thread.start();
        thread1.start();
    }
}
class Thread5 extends Thread{
    @Override
    public void run() {
        for (int i = 0; i <= 100; i++) {
            if (i%2==0){
                try {
                    sleep(100);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println(getName()+":"+i);
            }
        }
    }
}
class Thread6 extends Thread{
    @Override
    public void run() {
        for (int i = 0; i <= 100; i++) {
            if (i%2!=0){
                try {
                    sleep(100);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println(getName()+":"+i);
            }
        }
    }
}